-include ../../include/conv-mach-opt.mak

DIRS = \
  alltoall \
  onesided \
  pingpong \
  speed \

ifeq (1,$(CMK_SUPPORTS_MEMORY_ISOMALLOC))
# can reevaluate inclusion of this benchmark based on:
# - support for migrating Isomalloc heaps >= 2 GiB
# - shrinking the test to complete in 30 seconds or less
#  DIRS += isomalloc
endif

TESTDIRS = $(DIRS)

NONSCALEDIRS = \
  onesided \
  pingpong \
  speed \

TESTPDIRS = $(filter-out $(NONSCALEDIRS),$(TESTDIRS))

all: $(foreach i,$(DIRS),build-$i)

test: $(foreach i,$(TESTDIRS),test-$i)

testp: $(foreach i,$(TESTPDIRS),testp-$i)

clean: $(foreach i,$(DIRS),clean-$i)
	rm -f TAGS #*#
	rm -f core *~

$(foreach i,$(DIRS),build-$i):
	$(MAKE) -C $(subst build-,,$@) all OPTS='$(OPTS)'

$(foreach i,$(DIRS),test-$i):
	$(MAKE) -C $(subst test-,,$@) test OPTS='$(OPTS)' TESTOPTS='$(TESTOPTS)'

$(foreach i,$(TESTPDIRS),testp-$i):
	$(MAKE) -C $(subst testp-,,$@) testp OPTS='$(OPTS)' TESTOPTS='$(TESTOPTS)' P='$(P)'

$(foreach i,$(DIRS),clean-$i):
	$(MAKE) -C $(subst clean-,,$@) clean OPTS='$(OPTS)'
